﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="missionaddmsg.aspx.cs" Inherits="top_crm_missionaddmsg" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>特特CRM_客户营销</title>
    <link href="../css/common.css" rel="stylesheet" />
    <style>
        td{font-size:12px;}
        a{color:Blue; text-decoration:none;}
    </style>
</head>
<body style="padding:0px; margin:0px;">
    <form id="form1" runat="server">
        <div>
        <div class="navigation" style="height:600px;">

  <div class="crumbs"><a href="javascript:;" class="nolink">特特CRM_客户关系营销</a> 自定义短信群发 </div>
  <div class="absright">
    <ul>
      <li>
        <div class="msg">
        </div>
      </li>
    </ul>
  </div>


    <div id="main-content">
    
        <input type="button" value="返回列表" onclick="window.location.href='missionlist.aspx'" /> 

        <hr />
  <div style="border:solid 1px #CCE2FF; padding:4px; background-color:#E8F2FF; margin:0 3px 5px 0px; color:Red; font-weight:bold; width:700px">
      您可以创建多个客户营销计划，短信内容最多64个字，超过的内容将自动删除。
  </div>
  
              <asp:Panel ID="panel1" runat="server">
        <table>
            <tr>
                <td width=440 height=400 valign="top">
                
                <!--area start-->
              

            
            <!--新品活动营销-->
            <div id="area3">
            <table width="100%">
                <tr>
                    <td align="left" height="30" width="120">活动营销内容：</td>
                    <td>
                        <textarea id="actcontent" name="actcontent" cols="40" rows="3" onkeyup="gettextc(this, findObj('max_m').value, 'msg_c');if(this.value.length>findObj('max_m').value)this.value=this.value.substring(0, findObj('max_m').value);" onkeydown="if(this.value.length>findObj('max_m').value)this.value=this.value.substring(0, findObj('max_m').value);"></textarea>
                        <br />每条短信最多<span id="msg_t" style="color:Red">64</span>个字，超出部分不发送，剩余：<b id="msg_c" style="color:Red">64</b>
                        <br /><input type="button" value="短信预览" onclick="yulanMsg('actcontent')" />
                    </td>
                </tr>

                <tr>
                    <td align="left" height="30" width="120">短信名单：</td>
                    <td>
                        <asp:FileUpload ID="fuMsgList" runat="server" /> txt格式的文件，每行一个手机号码，参考例子下载
                    </td>
                </tr>

                <tr>
                    <td align="left" height="30">是否马上发送：</td>
                    <td>
                        <select name="sendnow" onchange="ShowDate(this)">
                            <option value="1">马上发送</option>
                            <option value="0">在指定时间发送</option>
                        </select><br />
                        会员多的情况下发送时间会比较长，请您耐心等待~
                    </td>
                </tr>
                <tr id="senddatearea" style="display:none;">
                    <td align="left" height="30">计划发送时间：</td>
                    <td>
                        <input name="actdate" type="text" value="<%=now %>" size="20"  />
                    </td>
                </tr>
            </table>
            </div>

                <!--area end-->
                
                </td>
            <td width="320" style="background:url('../reviewnew/images/msgbg.jpg') 0 0 no-repeat;" valign="top">
                <input type="hidden" name="yulanContent" id="yulanContent" />
                <div id="yulan" style="margin:86px 0 0 52px; color:white; width:140px;"></div>
                <div id="countArea" style="margin:66px 0 0 52px; color:white; width:140px;"></div>
            </td>
            </tr>
        </table>

        
            
            <table width="100%">
                <tr>
                    <td align="left" height="30" width="120">活动是否启用：</td>
                    <td align="left">
                        <select name="isstop">
                            <option value="0">启动</option>
                            <option value="1">暂停</option>
                        </select>
                    </td>
                </tr>
            </table>

            <table width="100%">
            <tr>
                <td align="left" height="30" colspan="2">  
                    <span style="color:red">创建新品营销计划的时候，建议不要一次创建多个导致发送失败，多组发送等一个组发送完毕了再创建下一个。</span>
                    <br />
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="创建营销计划" OnClientClick="return check()"  />
                </td>
            </tr>
        </table>

            </asp:Panel>

            
              <asp:Panel ID="panel2" runat="server" Visible="false">
                    <asp:Label ID="lbguid" runat="server" Visible="false"></asp:Label>
                    <asp:Label ID="label1" runat="server"></asp:Label> <br />
                    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="确认创建" />
              </asp:Panel>


            <input id="max_m" value="64" type="hidden"/>
            <script>
                function findObj(n, d) {
                    var p, i, x;
                    if (!d) d = document;
                    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
                        d = parent.frames[n.substring(p + 1)].document;
                        n = n.substring(0, p);
                    }
                    if (!(x = d[n]) && d.all) x = d.all[n];
                    for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
                    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
                    if (!x && d.getElementById) x = d.getElementById(n);
                    return x;
                }

                function gettextc(o, mc, show) {
                    var c_i = o.value.length;
                    var t_i = c_i <= mc ? (mc - c_i) : '0';
                    findObj(show).innerHTML = t_i;
                }



                function yulanMsg(id) {
                    var msg = document.getElementById(id).value;
                    //shopname = document.getElementById("shopname").value;
                    //msg = msg.replace("[shopname]", shopname);
                    //msg = msg.replace("[gift]", "优惠券");
                    //msg = msg.replace("[buynick]", "买家0001");
                    //msg = msg.replace("[shiptyp]", "圆通快递");
                    //msg = msg.replace("[shipnumber]", "1900209081740");
                    //msg = msg.replace("[freecard]", "包邮卡（仅限圆通）");

                    showMsg = "本条短信共计个" + msg.length + "字符";

                    if (msg.length > 64) {
                        showMsg = "本条短信共计个" + msg.length + "字符，被截取成64个字符";
                        msg = msg.substring(0, 64);
                    }

                    document.getElementById("yulanContent").value = msg;
                    document.getElementById("yulan").innerHTML = msg;
                    document.getElementById("countArea").innerHTML = showMsg;
                }

                function OpenDialogLable(url, w, h, editTxt) {
                    if (typeof (editTxt) == "undefined") {
                        editTxt = "";
                    }
                    if (navigator.appVersion.indexOf("MSIE") == -1) {
                        this.returnAction = function (strResult) {
                            if (strResult != null) {
                                if (strResult != "") {
                                    if (itemdata.indexOf(strResult) == -1) {
                                        itemdata = itemdata + strResult;
                                    }
                                    document.getElementById("productArea").innerHTML = itemdata;
                                }
                            }
                        }
                        window.open(url + '?d=' + Date() + "&t=" + escape(editTxt), 'newWin', 'modal=yes,width=' + w + ',height=' + h + ',top=200,left=300,resizable=no,scrollbars=no');
                        return;
                    } else {
                        var GetValue = showModalDialog(url + '?d=' + Date() + "&t=" + escape(editTxt), null, 'dialogWidth:' + w + 'px; dialogHeight:' + h + 'px;')
                        if (GetValue != null) {
                            if (GetValue != "") {
                                if (itemdata.indexOf(GetValue) == -1) {
                                    itemdata = itemdata + GetValue;
                                }
                                document.getElementById("productArea").innerHTML = itemdata;
                            }
                        }
                    }
                }

                var xmlHttp;
                var itemsStr;
                var itemsStrTxt;
                function createxmlHttpRequest() {
                    if (window.ActiveXObject)
                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    else if (window.XMLHttpRequest)
                        xmlHttp = new XMLHttpRequest();
                }

                function getResultStr(str) {
                    createxmlHttpRequest();

                    //获取当前使用样式
                    var style = "0";

                    var queryString = "/top/reviewnew/taobaoitem.aspx?act=getResultStr&isradio=1&style=" + style + "&ids=" + str + "&t=" + new Date().getTime();
                    xmlHttp.open("GET", queryString);
                    xmlHttp.onreadystatechange = handleStateChangeResultStr;
                    xmlHttp.send(null);
                }

                function handleStateChangeResultStr() {
                    if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                        document.getElementById("productArea").innerHTML = xmlHttp.responseText;
                    }
                }

            </script>

            <script>
                function InitUserCount(obj) {
                    document.getElementById("total").innerHTML = obj.options[obj.options.selectedIndex].title;
                }
</script>

    </div>
    </div>
    </div>
    </form>

        <script>
            function check() {
                //document.getElementById("Button1").value = "统计待发送会员数据中，请您稍等。。。";
                return true;
            }
        </script>

    <script language="javascript" type="text/javascript">
        function StartSend() {
            if (document.getElementById("typ").options.selectedIndex == 3) {
                //if(confirm("您确定要立即发送吗"))
            }
        }

        function InitHiddenArea(obj) {
            var obj = document.getElementById("area" + (obj.options.selectedIndex + 1));

            for (var i = 1; i < 5; i++) {
                document.getElementById("area" + i).style.display = "none";
            }

            obj.style.display = "";
        }

        function ShowDate(obj) {
            if (obj.options.selectedIndex == 1) {
                document.getElementById("senddatearea").style.display = "";
            } else {
                document.getElementById("senddatearea").style.display = "none";
            }
        }
    </script>

</body>
</html>